﻿/// <summary>
/// 单例基类
/// </summary>
/// <typeparam name="T">类型</typeparam>
public class Singleton<T> where T : class, new()
{
    /// <summary>
    /// 获得单例
    /// </summary>
    public static T Instance
    {
        get
        {
            if (instance == null)
            {
                lock (sysLock)
                {
                    if (instance == null)
                        instance = new T();
                }
            }
            return instance;
        }
    }
    private static T instance = null;
    private static readonly object sysLock = new object();
}
